package com.chinasoftinc.facommon.utils;

import java.util.TimerTask;

/**
 * 任务执行对象
 *
 * @since 2022-05-07
 */
public abstract class ExecuteTask extends TimerTask {
    private boolean isCanceled = false;

    @Override
    public final void run() {
        if (!isCanceled) {
            execute();
        }
    }

    @Override
    public boolean cancel() {
        isCanceled = true;
        return super.cancel();
    }

    public abstract void execute();
}
